<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--新闻资讯编辑页面-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新闻资讯</title>
<link href="css/style2.css" rel="stylesheet" type="text/css" />
<!--JS上传文件-->
<script type="text/javascript">

        function previewFile() {
            // var preview = document.querySelector('img');
            var preview = document.getElementById('view_image');
            var file = document.querySelector('input[type=file]').files[0];
            var reader = new FileReader();

            reader.onloadend = function () {
                preview.src = reader.result;
            }

            if (file) {
                reader.readAsDataURL(file);
            } else {
                preview.src = "";
            }
        }

    </script>


</head>

<body>

	<div class="formbody">

		<div class="formtitle">
			<span>资讯中心</span>
		</div>
		<form action="News_editInformation?id=${newsg.id }" method="post"
			enctype="multipart/form-data">
			<ul class="forminfo">
				<li><label>名称：</label><input name="title" type="text"
					class="dfinput" value="${newsg.title }" /><i>标题不能超过10个字符</i></li>
				<li><label>选择图片：</label> <img id="view_image"
					src="images/${newsg.pictures }" height="200" alt="Image preview...">
						<br> <label>&nbsp;</label><input class="selectfile"
							type="file" name="file" onchange="previewFile()"><br></li>
				<li><label>内容</label>
					<div style="margin-left: 88px">
						<!-- 加载编辑器的容器 -->
						<script id="container" name="contents" type="text/plain">
        ${newsg.contents }
                </script>
						<!-- 配置文件 -->
						<script type="text/javascript" src="ueditor.config.js"></script>
						<!-- 编辑器源码文件 -->
						<script type="text/javascript" src="ueditor.all.js"></script>
						<!-- 实例化编辑器 -->
						<script type="text/javascript">
                    <!--设置高度为600，不显示元素路径-->
                    var ue = UE.getEditor('container', {initialFrameHeight: 600, elementPathEnabled: false});
                </script>
					</div></li>
				<ul style="float: left; display: inline">
					<li style="display: inline"><a href="" target="rightFrame" />
						<input name="" type="submit" class="btn" value="确认" /></li>
				</ul>
			</ul>
		</form>
	</div>
</body>
</html>
